#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cstring>
#include<ctime>
#include<sstream>
using namespace std;
#define LL long long
const int N = 10000;
int num = 2;
vector<int> vec[N + 1];
int main()
{
	int edge = N*N*2*num*1.0/10;
	srand((unsigned)time(NULL));
	string temp;
	stringstream ss;
	ss << num;
	ss >> temp;
	temp += ".txt";
	string path = ".\\4\\"+temp;
	freopen(path.data(), "w", stdout);
	printf("%d %d\n", N, edge);
	for (int i = 2; i <= N; i++) {
		int r = abs(rand()*rand()) % (i - 1) + 1;
		vec[r].push_back(i);
		vec[i].push_back(r);
		printf("%d %d %d\n", r, i, rand() % 10000 + 1);
	}

	for (int i = 0; i <= edge-N; i++)
	{
		bool flag = true;
		int a = abs(rand()*rand()) % N + 1;
		int b = abs(rand()*rand()) % N + 1;
		for (int i = 0; i < vec[a].size(); i++)
			if (vec[a][i] == b)
			{//??????
				flag = false;
				break;
			}
		if (a == b)flag = false;
		if (flag == false)i--; //?????
		else 
		{
			vec[a].push_back(b);
			vec[b].push_back(a);
			printf("%d %d %d\n", a, b, rand() % 10000 + 1);
		}
	}
	return 0;
}
